//
//  TSWaterfallViewController.h
//  taosha
//
//  Created by lienbao on 16/05/2014.
//  Copyright (c) 2014 com.b5m.taosha. All rights reserved.
//

#import "WSBaseViewController.h"
#import "MJRefresh.h"
#import "WSWaterfallCell.h"
#import "WSWaterfallHeader.h"
#import "WSWaterfallFooter.h"
#import "CHTCollectionViewWaterfallLayout.h"

@interface WSWaterfallViewController : WSBaseViewController

@property (nonatomic, copy) NSString *waterfallCellClassName;
@property (nonatomic, copy) NSString *waterfallHeaderClassName;
@property (nonatomic, copy) NSString *waterfallFooterClassName;

@property (nonatomic, readonly) UICollectionView *collectionView;
@property (nonatomic, readonly) CHTCollectionViewWaterfallLayout *layout;

@property (nonatomic, strong) NSMutableArray *cellItems;

@property (nonatomic) CGFloat upThresholdY;
@property (nonatomic) CGFloat downThresholdY;

@property (nonatomic, assign)   NSInteger pageSize;
@property (nonatomic, assign)   NSInteger pageIndex;

//cell
- (UICollectionViewCell *)cellForIndexPath:(NSIndexPath *)indexPath;
- (id)cellForDataAtIndexPath:(NSIndexPath *)indexPath;
- (CGSize)cellForSizeAtIndexPath:(NSIndexPath *)indexPath;
- (void)didSelectCellAtIndexPath:(NSIndexPath *)indexPath;
- (void)fillData:(WSWaterfallCell *)cell atIndexPath:(NSIndexPath *)indexPath;
- (void)registerClassForCollectionView:(UICollectionView *)collectionView;
- (void)collectionElementKindSectionHeader:(UICollectionReusableView *)header ForIndexPath:(NSIndexPath*)indexPath;
- (void)collectionElementKindSectionFooter:(UICollectionReusableView *)footer ForIndexPath:(NSIndexPath*)indexPath;

// loading data
- (void)refreshData;
- (void)loadMore;
- (void)loadDataFinished:(NSArray *)items total:(NSInteger)count;
- (void)loadDataError:(NSError *)error;
- (void)stopAnimating;

- (void)scrollToCollectionViewTop;

@end
